package com.quan.whizenoa.data.web.controller;

import com.quan.commons.core.MyBaseController;
import com.quan.commons.vo.R;
import com.quan.whizenoa.data.service.IeasyOaProjectCenterService;
import com.quan.whizenoa.data.service.IeasySysPositionService;
import com.quan.whizenoa.data.service.SysDepartService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 员工信息
 *
 * @author yhaoquan
 * @email yhaoquan@163.com
 * @date 2023-02-18 17:14:01
 */
@Slf4j
@Api(tags = "初始化，导入数据")
@RestController
@RequestMapping("/init")
public class InitDataController extends MyBaseController {

    @Autowired
    private SysDepartService sysDepartService;

    @Autowired
    private IeasySysPositionService ieasySysPositionService;

    @Autowired
    private IeasyOaProjectCenterService projectCenterService;

    /**
     *  导入职务信息
     * @return
     */
    @GetMapping(value = "/listWithTreePost")
    public R listWithTreePost() {
        return R.ok().put("data", this.ieasySysPositionService.importIeasyPost2PmgPost());
    }

    /**
     * 导入项目信息
     * @return
     */
    @GetMapping(value = "/importIeasyProject2PmgProject")
    public R importIeasyProject2PmgProject() {
        return R.ok().put("data", this.projectCenterService.importIeasyProject2PmgProject());
    }

    /**
     * 树形结构查询，导入部门数据
     * @return
     */
    @GetMapping(value = "/listWithTree")
    public R listWithTree() {
        return R.ok().put("data", this.sysDepartService.importOaDepart2PmgDepart());
    }

    /**
     * 树形结构查询，导入部门及用户数据
     * @return
     */
    @GetMapping(value = "/deptEmps")
    public R deptEmps() {
        return R.ok().put("data", this.sysDepartService.importOaDepartEmp2PmgDepartEmp());
    }

}
